import { request } from '@umijs/max';

//获取全部的字典组列表
export const getDictionaryGroup = () =>
  request('/dictionaryGroup/list', {
    method: 'GET',
  });
//根据分组ID获取该组下的所有字典项
export const getArticleType = (groupId:string ='1788587268483579906') =>
request(`/dictionaryItem/list/${groupId}`, {
  method: 'GET',
});

//单个上传文件
export const uploadFile = (file:File) =>{
  const formData = new FormData();
  formData.append('multipartFile', file);
  return request('/file/upload',{
    baseUrl:'',
    method: 'POST',
    data: formData,
    timeout:100000,
  })
}


//获取新的通知，例如新关注、点赞信息等数量
export const getNoticeNum = () =>request('/sysUser/new-msg-count',{
  method: 'GET',
})
//获取最新的点赞信息。
export const getNoticeLike = () =>request('/like/new-like',{
  method: 'GET',
})
//获取关注列表
export const getNoticeFollow = () =>request('/follow/new-follow',{
  method: 'GET',
})
//收到的收藏通知列表
export const getNoticeFavorites = async() =>{
  const res = await request('/favorites/page-list',{
    method: 'POST',
    data:{
      "pageCurrent": 1,
      "pageSize": 1000
    }
  })
  return res?.list||[]
}
//获取最新的评论列表。
export const getNoticeComment = () =>request('/comment/new-comment',{
  method: 'GET',
})


//将未读更新为已读
export const readNoticeFavorites = () =>request('/favorites/read',{
  method: 'PUT',
})

//将未读更新为已读
export const readNoticeFollow = () =>request('/follow/read',{
  method: 'PUT',
})

//将未读更新为已读
export const readNoticeLike = () =>request('/like/read',{
  method: 'PUT',
})

//将未读更新为已读
export const readNoticeComment = () =>request('/comment/read',{
  method: 'PUT',
})
